//package com.wushijia.mq;
//
//import java.io.IOException;
//import java.net.URLDecoder;
//import java.text.DateFormat;
//import java.text.SimpleDateFormat;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.regex.Matcher;
//import java.util.regex.Pattern;
//import java.util.regex.PatternSyntaxException;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.apache.commons.net.telnet.TelnetClient;
//import org.joda.time.DateTime;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * telnet测试
// *
// * @author houyangyang
// * @create 2017-11-09 13:17
// **/
//
//public class TelnetTest {
//
//  private final static Logger LOGGER = LoggerFactory.getLogger(TelnetTest.class);
//  private final static String PATTERN = "yyyy-MM-dd HH:mm:ss";
//
//  public static void main(String[] args) {
//    System.out.println(URLDecoder.decode("%E5%93%81%E7%89%8C%E8%AF%8D"));
//    Calendar ca = Calendar.getInstance();
//    ca.setTime(new Date());
//    int hour = 23 - ca.get(Calendar.HOUR_OF_DAY);
//    int minute = 59 - ca.get(Calendar.MINUTE);
//    int second = 59 - ca.get(Calendar.SECOND);
//
//    String[] leftTime = new String[]{hour < 10 ? "0" + hour : String.valueOf(hour), minute < 10 ? "0" + minute : String.valueOf(minute),
//        second < 10 ? "0" + second : String.valueOf(second)};
//    System.out.println("今天倒计时：" + leftTime[0] + ":" + leftTime[1] + ":" + leftTime[2]);
//
//    long l = 1522052902000L;
//    DateFormat df = new SimpleDateFormat();
//    DateTime dateTime = new DateTime(l);
//    System.out.println(dateTime.toString(PATTERN));
//
//    System.out.println(DigestUtils.shaHex(""));
//
//  }
//
//  public static boolean isChinaPhoneLegal(String str) throws PatternSyntaxException {
//    String regExp = "^1[3|4|5|7|8][0-9]\\d{8}$";
//    Pattern p = Pattern.compile(regExp);
//    Matcher m = p.matcher(str);
//    return m.matches();
//  }
//
//  public static void test() {
//    TelnetClient telnet;
//    telnet = new TelnetClient();
//    try {
//      telnet.connect("onsaddr-internal.aliyun.com", 8080);
//      LOGGER.info("TELNET onsaddr-internal.aliyun.com:8080 SUCCESS!");
//    } catch (IOException e) {
//      e.printStackTrace();
//      Date time = new Date();
//      String msgtext = time + "\n" + "onsaddr-internal.aliyun.com" + ":" + "8080" + " is not reachable!";
//      LOGGER.error(msgtext);
//    }
//
//    try {
//      telnet.disconnect();
//    } catch (IOException e) {
//      e.printStackTrace();
//    }
//  }
//}
